package com.briup.jz.web.controller;

import com.briup.jz.bean.BaseFile;
import com.briup.jz.bean.BaseLog;
import com.briup.jz.service.IBaseFileService;
import com.briup.jz.utils.Message;
import com.briup.jz.utils.MessageUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(description="文件相关接口")
@Validated
@RestController   //返回值为json对象
@RequestMapping("/BaseFile")
public class BaseFileController {

    //依赖注入
    @Resource
    private IBaseFileService is;


    @ApiOperation(value = "更新性能和插入文件")
    @PostMapping("/save")
    public Message save(BaseFile baseFile){
        //插入数据
        is.saveOrUpdat(baseFile);
        return MessageUtil.success("更新成功了");
    }


    @ApiOperation(value = "删除文件")
    @PostMapping("/delete")
    public Message delete(String id){
        //删除用户
        is.deleteById(id);
        return MessageUtil.success("删除成功了");
    }

    @ApiOperation(value = "展示文件")
    @PostMapping("/show")
    public Message show(String id){

        //查询
        return MessageUtil.success( is.query(id));
    }






}
